.class public Lcom/instagram/android/mediacache/n;
.super Ljava/lang/Object;
.source "IgVideoCache.java"


# static fields
.field private static a:Lcom/instagram/android/mediacache/n;


# instance fields
.field private final b:Landroid/os/Handler;

.field private c:Ljava/util/concurrent/ExecutorService;

.field private final d:Landroid/content/Context;

.field private e:Lch/boye/httpclientandroidlib/client/HttpClient;

.field private f:Lcom/instagram/f/a/c;

.field private final g:Ljava/lang/Object;

.field private h:Ljava/util/LinkedList;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/LinkedList",
            "<",
            "Landroid/net/Uri;",
            ">;"
        }
    .end annotation
.end field

.field private i:Ljava/util/Map;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/Map",
            "<",
            "Landroid/net/Uri;",
            "Lcom/instagram/android/mediacache/p;",
            ">;"
        }
    .end annotation
.end field

.field private j:Ljava/util/Map;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/Map",
            "<",
            "Landroid/net/Uri;",
            "Ljava/util/concurrent/Future;",
            ">;"
        }
    .end annotation
.end field


# direct methods
.method private constructor <init>(Landroid/content/Context;)V
    .locals 2
    .parameter

    .prologue
    .line 137
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 97
    new-instance v0, Lcom/instagram/android/mediacache/q;

    const/4 v1, 0x0

    invoke-direct {v0, v1}, Lcom/instagram/android/mediacache/q;-><init>(Lcom/instagram/android/mediacache/o;)V

    iput-object v0, p0, Lcom/instagram/android/mediacache/n;->b:Landroid/os/Handler;

    .line 105
    invoke-static {}, Ljava/util/concurrent/Executors;->newSingleThreadExecutor()Ljava/util/concurrent/ExecutorService;

    move-result-object v0

    iput-object v0, p0, Lcom/instagram/android/mediacache/n;->c:Ljava/util/concurrent/ExecutorService;

    .line 115
    new-instance v0, Ljava/lang/Object;

    invoke-direct {v0}, Ljava/lang/Object;-><init>()V

    iput-object v0, p0, Lcom/instagram/android/mediacache/n;->g:Ljava/lang/Object;

    .line 117
    new-instance v0, Ljava/util/LinkedList;

    invoke-direct {v0}, Ljava/util/LinkedList;-><init>()V

    iput-object v0, p0, Lcom/instagram/android/mediacache/n;->h:Ljava/util/LinkedList;

    .line 118
    new-instance v0, Ljava/util/HashMap;

    invoke-direct {v0}, Ljava/util/HashMap;-><init>()V

    iput-object v0, p0, Lcom/instagram/android/mediacache/n;->i:Ljava/util/Map;

    .line 119
    new-instance v0, Ljava/util/HashMap;

    invoke-direct {v0}, Ljava/util/HashMap;-><init>()V

    iput-object v0, p0, Lcom/instagram/android/mediacache/n;->j:Ljava/util/Map;

    .line 138
    invoke-virtual {p1}, Landroid/content/Context;->getApplicationContext()Landroid/content/Context;

    move-result-object v0

    iput-object v0, p0, Lcom/instagram/android/mediacache/n;->d:Landroid/content/Context;

    .line 139
    return-void
.end method

.method static synthetic a(Lcom/instagram/android/mediacache/n;)Landroid/os/Handler;
    .locals 1
    .parameter

    .prologue
    .line 54
    iget-object v0, p0, Lcom/instagram/android/mediacache/n;->b:Landroid/os/Handler;

    return-object v0
.end method

.method public static a()Lcom/instagram/android/mediacache/n;
    .locals 1

    .prologue
    .line 126
    sget-object v0, Lcom/instagram/android/mediacache/n;->a:Lcom/instagram/android/mediacache/n;

    return-object v0
.end method

.method public static a(Landroid/content/Context;)V
    .locals 1
    .parameter

    .prologue
    .line 134
    new-instance v0, Lcom/instagram/android/mediacache/n;

    invoke-direct {v0, p0}, Lcom/instagram/android/mediacache/n;-><init>(Landroid/content/Context;)V

    sput-object v0, Lcom/instagram/android/mediacache/n;->a:Lcom/instagram/android/mediacache/n;

    .line 135
    return-void
.end method

.method private a(Landroid/net/Uri;[B)V
    .locals 4
    .parameter
    .parameter

    .prologue
    const/4 v2, 0x0

    .line 330
    .line 333
    :try_start_0
    invoke-direct {p0}, Lcom/instagram/android/mediacache/n;->d()Lcom/instagram/f/a/c;

    move-result-object v0

    invoke-direct {p0, p1}, Lcom/instagram/android/mediacache/n;->f(Landroid/net/Uri;)Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Lcom/instagram/f/a/c;->c(Ljava/lang/String;)Lcom/instagram/f/a/e;
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    move-result-object v1

    .line 334
    :try_start_1
    new-instance v3, Ljava/io/BufferedOutputStream;

    const/4 v0, 0x0

    invoke-virtual {v1, v0}, Lcom/instagram/f/a/e;->a(I)Ljava/io/OutputStream;

    move-result-object v0

    invoke-direct {v3, v0}, Ljava/io/BufferedOutputStream;-><init>(Ljava/io/OutputStream;)V
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_1

    .line 335
    :try_start_2
    invoke-virtual {v3, p2}, Ljava/io/OutputStream;->write([B)V
    :try_end_2
    .catchall {:try_start_2 .. :try_end_2} :catchall_2

    .line 337
    if-eqz v3, :cond_0

    .line 338
    invoke-virtual {v3}, Ljava/io/OutputStream;->close()V

    .line 340
    :cond_0
    if-eqz v1, :cond_1

    .line 341
    invoke-virtual {v1}, Lcom/instagram/f/a/e;->a()V

    .line 344
    :cond_1
    return-void

    .line 337
    :catchall_0
    move-exception v0

    move-object v1, v2

    :goto_0
    if-eqz v2, :cond_2

    .line 338
    invoke-virtual {v2}, Ljava/io/OutputStream;->close()V

    .line 340
    :cond_2
    if-eqz v1, :cond_3

    .line 341
    invoke-virtual {v1}, Lcom/instagram/f/a/e;->a()V

    :cond_3
    throw v0

    .line 337
    :catchall_1
    move-exception v0

    goto :goto_0

    :catchall_2
    move-exception v0

    move-object v2, v3

    goto :goto_0
.end method

.method static synthetic a(Lcom/instagram/android/mediacache/n;Landroid/net/Uri;)V
    .locals 0
    .parameter
    .parameter

    .prologue
    .line 54
    invoke-direct {p0, p1}, Lcom/instagram/android/mediacache/n;->e(Landroid/net/Uri;)V

    return-void
.end method

.method static synthetic a(Lcom/instagram/android/mediacache/n;Landroid/net/Uri;[B)V
    .locals 0
    .parameter
    .parameter
    .parameter

    .prologue
    .line 54
    invoke-direct {p0, p1, p2}, Lcom/instagram/android/mediacache/n;->a(Landroid/net/Uri;[B)V

    return-void
.end method

.method private c()V
    .locals 6

    .prologue
    .line 255
    iget-object v2, p0, Lcom/instagram/android/mediacache/n;->g:Ljava/lang/Object;

    monitor-enter v2

    .line 256
    :try_start_0
    iget-object v0, p0, Lcom/instagram/android/mediacache/n;->j:Ljava/util/Map;

    invoke-interface {v0}, Ljava/util/Map;->size()I

    move-result v0

    const/4 v1, 0x1

    if-ge v0, v1, :cond_0

    iget-object v0, p0, Lcom/instagram/android/mediacache/n;->h:Ljava/util/LinkedList;

    invoke-virtual {v0}, Ljava/util/LinkedList;->isEmpty()Z

    move-result v0

    if-nez v0, :cond_0

    .line 257
    iget-object v0, p0, Lcom/instagram/android/mediacache/n;->h:Ljava/util/LinkedList;

    invoke-virtual {v0}, Ljava/util/LinkedList;->getFirst()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/net/Uri;

    .line 259
    if-eqz v0, :cond_0

    .line 260
    iget-object v3, p0, Lcom/instagram/android/mediacache/n;->c:Ljava/util/concurrent/ExecutorService;

    new-instance v4, Lcom/instagram/android/j/a;

    invoke-direct {p0}, Lcom/instagram/android/mediacache/n;->f()Lch/boye/httpclientandroidlib/client/HttpClient;

    move-result-object v5

    iget-object v1, p0, Lcom/instagram/android/mediacache/n;->i:Ljava/util/Map;

    invoke-interface {v1, v0}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Lcom/instagram/android/j/b;

    invoke-direct {v4, v5, v0, v1}, Lcom/instagram/android/j/a;-><init>(Lch/boye/httpclientandroidlib/client/HttpClient;Landroid/net/Uri;Lcom/instagram/android/j/b;)V

    invoke-interface {v3, v4}, Ljava/util/concurrent/ExecutorService;->submit(Ljava/lang/Runnable;)Ljava/util/concurrent/Future;

    move-result-object v1

    .line 263
    iget-object v3, p0, Lcom/instagram/android/mediacache/n;->j:Ljava/util/Map;

    invoke-interface {v3, v0, v1}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    .line 266
    :cond_0
    monitor-exit v2

    .line 267
    return-void

    .line 266
    :catchall_0
    move-exception v0

    monitor-exit v2
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw v0
.end method

.method private d()Lcom/instagram/f/a/c;
    .locals 1

    .prologue
    .line 274
    iget-object v0, p0, Lcom/instagram/android/mediacache/n;->f:Lcom/instagram/f/a/c;

    if-nez v0, :cond_0

    .line 275
    invoke-direct {p0}, Lcom/instagram/android/mediacache/n;->e()V

    .line 277
    :cond_0
    iget-object v0, p0, Lcom/instagram/android/mediacache/n;->f:Lcom/instagram/f/a/c;

    return-object v0
.end method

.method private declared-synchronized e()V
    .locals 7

    .prologue
    .line 281
    monitor-enter p0

    :try_start_0
    iget-object v0, p0, Lcom/instagram/android/mediacache/n;->f:Lcom/instagram/f/a/c;
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    if-eqz v0, :cond_0

    .line 303
    :goto_0
    monitor-exit p0

    return-void

    .line 283
    :cond_0
    :try_start_1
    const-string v0, "IgVideoCache"

    const-string v1, "createStorage()"

    invoke-static {v0, v1}, Lcom/facebook/e/a/a;->b(Ljava/lang/String;Ljava/lang/String;)V
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    .line 286
    :try_start_2
    iget-object v0, p0, Lcom/instagram/android/mediacache/n;->d:Landroid/content/Context;

    const-string v1, "video"

    const/4 v2, 0x1

    invoke-static {v0, v1, v2}, Lcom/instagram/f/a/b;->a(Landroid/content/Context;Ljava/lang/String;Z)Ljava/io/File;

    move-result-object v2

    .line 287
    const v0, 0x3dcccccd

    const-wide/32 v3, 0x6400000

    invoke-static {v2, v0, v3, v4}, Lcom/instagram/f/a/b;->a(Ljava/io/File;FJ)J

    move-result-wide v0

    .line 289
    const-wide/16 v3, 0x0

    cmp-long v3, v0, v3

    if-gtz v3, :cond_1

    .line 292
    iget-object v0, p0, Lcom/instagram/android/mediacache/n;->d:Landroid/content/Context;

    const-string v1, "video"

    const/4 v2, 0x0

    invoke-static {v0, v1, v2}, Lcom/instagram/f/a/b;->a(Landroid/content/Context;Ljava/lang/String;Z)Ljava/io/File;

    move-result-object v2

    .line 293
    const v0, 0x3dcccccd

    const-wide/32 v3, 0x6400000

    invoke-static {v2, v0, v3, v4}, Lcom/instagram/f/a/b;->a(Ljava/io/File;FJ)J

    move-result-wide v0

    .line 294
    const-string v3, "IgVideoCache"

    const-string v4, "Couldn\'t create in external storage"

    invoke-static {v3, v4}, Lcom/instagram/g/c;->b(Ljava/lang/String;Ljava/lang/String;)V

    .line 297
    :cond_1
    const-string v3, "IgVideoCache"

    new-instance v4, Ljava/lang/StringBuilder;

    invoke-direct {v4}, Ljava/lang/StringBuilder;-><init>()V

    const-string v5, "Cache directory: "

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    invoke-virtual {v4, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v4

    invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v4

    invoke-static {v3, v4}, Lcom/facebook/e/a/a;->b(Ljava/lang/String;Ljava/lang/String;)V

    .line 298
    const-string v3, "IgVideoCache"

    new-instance v4, Ljava/lang/StringBuilder;

    invoke-direct {v4}, Ljava/lang/StringBuilder;-><init>()V

    const-string v5, "Cache size: "

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    const-wide/32 v5, 0x100000

    div-long v5, v0, v5

    invoke-virtual {v4, v5, v6}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;

    move-result-object v4

    const-string v5, "MB"

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v4

    invoke-static {v3, v4}, Lcom/facebook/e/a/a;->b(Ljava/lang/String;Ljava/lang/String;)V

    .line 299
    const/4 v3, 0x0

    const/4 v4, 0x1

    invoke-static {v2, v3, v4, v0, v1}, Lcom/instagram/f/a/c;->a(Ljava/io/File;IIJ)Lcom/instagram/f/a/c;

    move-result-object v0

    iput-object v0, p0, Lcom/instagram/android/mediacache/n;->f:Lcom/instagram/f/a/c;
    :try_end_2
    .catchall {:try_start_2 .. :try_end_2} :catchall_0
    .catch Ljava/io/IOException; {:try_start_2 .. :try_end_2} :catch_0

    goto :goto_0

    .line 300
    :catch_0
    move-exception v0

    .line 301
    :try_start_3
    new-instance v1, Ljava/lang/RuntimeException;

    const-string v2, "Unable to open video cache"

    invoke-direct {v1, v2, v0}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/String;Ljava/lang/Throwable;)V

    throw v1
    :try_end_3
    .catchall {:try_start_3 .. :try_end_3} :catchall_0

    .line 281
    :catchall_0
    move-exception v0

    monitor-exit p0

    throw v0
.end method

.method private e(Landroid/net/Uri;)V
    .locals 2
    .parameter

    .prologue
    .line 246
    iget-object v1, p0, Lcom/instagram/android/mediacache/n;->g:Ljava/lang/Object;

    monitor-enter v1

    .line 247
    :try_start_0
    iget-object v0, p0, Lcom/instagram/android/mediacache/n;->i:Ljava/util/Map;

    invoke-interface {v0, p1}, Ljava/util/Map;->remove(Ljava/lang/Object;)Ljava/lang/Object;

    .line 248
    iget-object v0, p0, Lcom/instagram/android/mediacache/n;->h:Ljava/util/LinkedList;

    invoke-virtual {v0, p1}, Ljava/util/LinkedList;->remove(Ljava/lang/Object;)Z

    .line 249
    iget-object v0, p0, Lcom/instagram/android/mediacache/n;->j:Ljava/util/Map;

    invoke-interface {v0, p1}, Ljava/util/Map;->remove(Ljava/lang/Object;)Ljava/lang/Object;

    .line 250
    invoke-direct {p0}, Lcom/instagram/android/mediacache/n;->c()V

    .line 251
    monitor-exit v1

    .line 252
    return-void

    .line 251
    :catchall_0
    move-exception v0

    monitor-exit v1
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw v0
.end method

.method private f()Lch/boye/httpclientandroidlib/client/HttpClient;
    .locals 1

    .prologue
    .line 306
    iget-object v0, p0, Lcom/instagram/android/mediacache/n;->e:Lch/boye/httpclientandroidlib/client/HttpClient;

    if-nez v0, :cond_0

    .line 307
    invoke-direct {p0}, Lcom/instagram/android/mediacache/n;->g()V

    .line 309
    :cond_0
    iget-object v0, p0, Lcom/instagram/android/mediacache/n;->e:Lch/boye/httpclientandroidlib/client/HttpClient;

    return-object v0
.end method

.method private f(Landroid/net/Uri;)Ljava/lang/String;
    .locals 1
    .parameter

    .prologue
    .line 270
    invoke-virtual {p1}, Landroid/net/Uri;->hashCode()I

    move-result v0

    invoke-static {v0}, Ljava/lang/Integer;->toHexString(I)Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method private declared-synchronized g()V
    .locals 5

    .prologue
    .line 350
    monitor-enter p0

    :try_start_0
    iget-object v0, p0, Lcom/instagram/android/mediacache/n;->e:Lch/boye/httpclientandroidlib/client/HttpClient;
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    if-eqz v0, :cond_0

    .line 367
    :goto_0
    monitor-exit p0

    return-void

    .line 352
    :cond_0
    :try_start_1
    new-instance v0, Lch/boye/httpclientandroidlib/conn/scheme/SchemeRegistry;

    invoke-direct {v0}, Lch/boye/httpclientandroidlib/conn/scheme/SchemeRegistry;-><init>()V

    .line 354
    new-instance v1, Lch/boye/httpclientandroidlib/conn/scheme/Scheme;

    const-string v2, "http"

    const/16 v3, 0x50

    invoke-static {}, Lch/boye/httpclientandroidlib/conn/scheme/PlainSocketFactory;->getSocketFactory()Lch/boye/httpclientandroidlib/conn/scheme/PlainSocketFactory;

    move-result-object v4

    invoke-direct {v1, v2, v3, v4}, Lch/boye/httpclientandroidlib/conn/scheme/Scheme;-><init>(Ljava/lang/String;ILch/boye/httpclientandroidlib/conn/scheme/SchemeSocketFactory;)V

    invoke-virtual {v0, v1}, Lch/boye/httpclientandroidlib/conn/scheme/SchemeRegistry;->register(Lch/boye/httpclientandroidlib/conn/scheme/Scheme;)Lch/boye/httpclientandroidlib/conn/scheme/Scheme;

    .line 355
    new-instance v1, Lch/boye/httpclientandroidlib/conn/scheme/Scheme;

    const-string v2, "https"

    const/16 v3, 0x1bb

    invoke-static {}, Lch/boye/httpclientandroidlib/conn/ssl/SSLSocketFactory;->getSocketFactory()Lch/boye/httpclientandroidlib/conn/ssl/SSLSocketFactory;

    move-result-object v4

    invoke-direct {v1, v2, v3, v4}, Lch/boye/httpclientandroidlib/conn/scheme/Scheme;-><init>(Ljava/lang/String;ILch/boye/httpclientandroidlib/conn/scheme/SchemeSocketFactory;)V

    invoke-virtual {v0, v1}, Lch/boye/httpclientandroidlib/conn/scheme/SchemeRegistry;->register(Lch/boye/httpclientandroidlib/conn/scheme/Scheme;)Lch/boye/httpclientandroidlib/conn/scheme/Scheme;

    .line 357
    new-instance v1, Lch/boye/httpclientandroidlib/impl/conn/tsccm/ThreadSafeClientConnManager;

    invoke-direct {v1, v0}, Lch/boye/httpclientandroidlib/impl/conn/tsccm/ThreadSafeClientConnManager;-><init>(Lch/boye/httpclientandroidlib/conn/scheme/SchemeRegistry;)V

    .line 358
    const/16 v0, 0xa

    invoke-virtual {v1, v0}, Lch/boye/httpclientandroidlib/impl/conn/tsccm/ThreadSafeClientConnManager;->setDefaultMaxPerRoute(I)V

    .line 359
    const/16 v0, 0xa

    invoke-virtual {v1, v0}, Lch/boye/httpclientandroidlib/impl/conn/tsccm/ThreadSafeClientConnManager;->setMaxTotal(I)V

    .line 361
    new-instance v0, Lch/boye/httpclientandroidlib/params/BasicHttpParams;

    invoke-direct {v0}, Lch/boye/httpclientandroidlib/params/BasicHttpParams;-><init>()V

    .line 362
    const/4 v2, 0x1

    invoke-static {v0, v2}, Lch/boye/httpclientandroidlib/params/HttpConnectionParams;->setTcpNoDelay(Lch/boye/httpclientandroidlib/params/HttpParams;Z)V

    .line 363
    const/16 v2, 0x2710

    invoke-static {v0, v2}, Lch/boye/httpclientandroidlib/params/HttpConnectionParams;->setConnectionTimeout(Lch/boye/httpclientandroidlib/params/HttpParams;I)V

    .line 364
    const/16 v2, 0x2710

    invoke-static {v0, v2}, Lch/boye/httpclientandroidlib/params/HttpConnectionParams;->setSoTimeout(Lch/boye/httpclientandroidlib/params/HttpParams;I)V

    .line 366
    new-instance v2, Lch/boye/httpclientandroidlib/impl/client/DefaultHttpClient;

    invoke-direct {v2, v1, v0}, Lch/boye/httpclientandroidlib/impl/client/DefaultHttpClient;-><init>(Lch/boye/httpclientandroidlib/conn/ClientConnectionManager;Lch/boye/httpclientandroidlib/params/HttpParams;)V

    iput-object v2, p0, Lcom/instagram/android/mediacache/n;->e:Lch/boye/httpclientandroidlib/client/HttpClient;
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    goto :goto_0

    .line 350
    :catchall_0
    move-exception v0

    monitor-exit p0

    throw v0
.end method


# virtual methods
.method public a(Landroid/net/Uri;)V
    .locals 3
    .parameter

    .prologue
    .line 177
    const-string v0, "IgVideoCache"

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "Prefetch "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-static {v0, v1}, Lcom/facebook/e/a/a;->b(Ljava/lang/String;Ljava/lang/String;)V

    .line 178
    const/4 v0, 0x0

    const/4 v1, 0x0

    invoke-virtual {p0, p1, v0, v1}, Lcom/instagram/android/mediacache/n;->a(Landroid/net/Uri;ZLcom/instagram/android/mediacache/r;)V

    .line 179
    return-void
.end method

.method public a(Landroid/net/Uri;ZLcom/instagram/android/mediacache/r;)V
    .locals 4
    .parameter
    .parameter
    .parameter

    .prologue
    .line 186
    invoke-virtual {p0, p1}, Lcom/instagram/android/mediacache/n;->c(Landroid/net/Uri;)Z

    move-result v0

    if-eqz v0, :cond_1

    .line 187
    if-eqz p3, :cond_0

    .line 188
    invoke-interface {p3}, Lcom/instagram/android/mediacache/r;->a()V

    .line 230
    :cond_0
    :goto_0
    return-void

    .line 193
    :cond_1
    iget-object v1, p0, Lcom/instagram/android/mediacache/n;->g:Ljava/lang/Object;

    monitor-enter v1

    .line 194
    :try_start_0
    iget-object v0, p0, Lcom/instagram/android/mediacache/n;->i:Ljava/util/Map;

    invoke-interface {v0, p1}, Ljava/util/Map;->containsKey(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_4

    .line 195
    iget-object v0, p0, Lcom/instagram/android/mediacache/n;->i:Ljava/util/Map;

    invoke-interface {v0, p1}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/instagram/android/mediacache/p;

    .line 197
    if-eqz p3, :cond_2

    .line 200
    invoke-virtual {v0, p3}, Lcom/instagram/android/mediacache/p;->a(Lcom/instagram/android/mediacache/r;)V

    .line 203
    :cond_2
    if-eqz p2, :cond_3

    .line 204
    const-string v0, "IgVideoCache"

    new-instance v2, Ljava/lang/StringBuilder;

    invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V

    const-string v3, "Reordering "

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v2

    const-string v3, " to front of queue"

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-static {v0, v2}, Lcom/facebook/e/a/a;->b(Ljava/lang/String;Ljava/lang/String;)V

    .line 205
    iget-object v0, p0, Lcom/instagram/android/mediacache/n;->h:Ljava/util/LinkedList;

    invoke-virtual {v0, p1}, Ljava/util/LinkedList;->remove(Ljava/lang/Object;)Z

    .line 206
    iget-object v0, p0, Lcom/instagram/android/mediacache/n;->h:Ljava/util/LinkedList;

    invoke-virtual {v0, p1}, Ljava/util/LinkedList;->addFirst(Ljava/lang/Object;)V

    .line 229
    :cond_3
    :goto_1
    monitor-exit v1

    goto :goto_0

    :catchall_0
    move-exception v0

    monitor-exit v1
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw v0

    .line 208
    :cond_4
    :try_start_1
    invoke-virtual {p0, p1}, Lcom/instagram/android/mediacache/n;->c(Landroid/net/Uri;)Z

    move-result v0

    if-eqz v0, :cond_5

    .line 211
    if-eqz p3, :cond_3

    .line 212
    invoke-interface {p3}, Lcom/instagram/android/mediacache/r;->a()V

    goto :goto_1

    .line 215
    :cond_5
    new-instance v0, Lcom/instagram/android/mediacache/p;

    invoke-direct {v0, p0, p1}, Lcom/instagram/android/mediacache/p;-><init>(Lcom/instagram/android/mediacache/n;Landroid/net/Uri;)V

    .line 216
    invoke-virtual {v0, p3}, Lcom/instagram/android/mediacache/p;->a(Lcom/instagram/android/mediacache/r;)V

    .line 217
    iget-object v2, p0, Lcom/instagram/android/mediacache/n;->i:Ljava/util/Map;

    invoke-interface {v2, p1, v0}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    .line 219
    if-eqz p2, :cond_6

    .line 220
    const-string v0, "IgVideoCache"

    new-instance v2, Ljava/lang/StringBuilder;

    invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V

    const-string v3, "Adding "

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v2

    const-string v3, " at front of queue"

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-static {v0, v2}, Lcom/facebook/e/a/a;->b(Ljava/lang/String;Ljava/lang/String;)V

    .line 221
    iget-object v0, p0, Lcom/instagram/android/mediacache/n;->h:Ljava/util/LinkedList;

    invoke-virtual {v0, p1}, Ljava/util/LinkedList;->addFirst(Ljava/lang/Object;)V

    .line 227
    :goto_2
    invoke-direct {p0}, Lcom/instagram/android/mediacache/n;->c()V

    goto :goto_1

    .line 223
    :cond_6
    const-string v0, "IgVideoCache"

    new-instance v2, Ljava/lang/StringBuilder;

    invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V

    const-string v3, "Adding "

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v2

    const-string v3, " at back of queue"

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-static {v0, v2}, Lcom/facebook/e/a/a;->b(Ljava/lang/String;Ljava/lang/String;)V

    .line 224
    iget-object v0, p0, Lcom/instagram/android/mediacache/n;->h:Ljava/util/LinkedList;

    invoke-virtual {v0, p1}, Ljava/util/LinkedList;->addLast(Ljava/lang/Object;)V
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    goto :goto_2
.end method

.method public b()J
    .locals 2

    .prologue
    .line 142
    invoke-direct {p0}, Lcom/instagram/android/mediacache/n;->d()Lcom/instagram/f/a/c;

    move-result-object v0

    invoke-virtual {v0}, Lcom/instagram/f/a/c;->a()J

    move-result-wide v0

    return-wide v0
.end method

.method public b(Landroid/net/Uri;)V
    .locals 4
    .parameter

    .prologue
    const/4 v3, 0x0

    .line 233
    iget-object v1, p0, Lcom/instagram/android/mediacache/n;->g:Ljava/lang/Object;

    monitor-enter v1

    .line 234
    :try_start_0
    iget-object v0, p0, Lcom/instagram/android/mediacache/n;->i:Ljava/util/Map;

    invoke-interface {v0, p1}, Ljava/util/Map;->containsKey(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_0

    .line 235
    iget-object v0, p0, Lcom/instagram/android/mediacache/n;->i:Ljava/util/Map;

    invoke-interface {v0, p1}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/instagram/android/mediacache/p;

    .line 236
    const/4 v2, 0x0

    invoke-virtual {v0, v2}, Lcom/instagram/android/mediacache/p;->a(Lcom/instagram/android/mediacache/r;)V

    .line 238
    :cond_0
    monitor-exit v1
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    .line 242
    iget-object v0, p0, Lcom/instagram/android/mediacache/n;->b:Landroid/os/Handler;

    invoke-virtual {v0, v3}, Landroid/os/Handler;->removeCallbacksAndMessages(Ljava/lang/Object;)V

    .line 243
    return-void

    .line 238
    :catchall_0
    move-exception v0

    :try_start_1
    monitor-exit v1
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    throw v0
.end method

.method public c(Landroid/net/Uri;)Z
    .locals 2
    .parameter

    .prologue
    .line 313
    invoke-direct {p0}, Lcom/instagram/android/mediacache/n;->d()Lcom/instagram/f/a/c;

    move-result-object v0

    invoke-direct {p0, p1}, Lcom/instagram/android/mediacache/n;->f(Landroid/net/Uri;)Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Lcom/instagram/f/a/c;->a(Ljava/lang/String;)Z

    move-result v0

    return v0
.end method

.method public d(Landroid/net/Uri;)Lcom/instagram/android/mediacache/s;
    .locals 3
    .parameter

    .prologue
    .line 318
    :try_start_0
    invoke-direct {p0}, Lcom/instagram/android/mediacache/n;->d()Lcom/instagram/f/a/c;

    move-result-object v0

    invoke-direct {p0, p1}, Lcom/instagram/android/mediacache/n;->f(Landroid/net/Uri;)Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Lcom/instagram/f/a/c;->b(Ljava/lang/String;)Lcom/instagram/f/a/h;

    move-result-object v1

    .line 319
    if-eqz v1, :cond_0

    .line 320
    new-instance v0, Lcom/instagram/android/mediacache/s;

    invoke-direct {v0, v1}, Lcom/instagram/android/mediacache/s;-><init>(Lcom/instagram/f/a/h;)V
    :try_end_0
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0

    .line 326
    :goto_0
    return-object v0

    .line 322
    :catch_0
    move-exception v0

    .line 323
    const-string v0, "IgVideoCache"

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "Unable to retrieve entry for uri "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-static {v0, v1}, Lcom/facebook/e/a/a;->e(Ljava/lang/String;Ljava/lang/String;)V

    .line 326
    :cond_0
    const/4 v0, 0x0

    goto :goto_0
.end method
